package com.chiffoyqc.factory;

import com.alibaba.fastjson.JSONObject;
import com.chiffoyqc.sheet.RetureCodeSheet;

import java.util.Map;

/**
 * Created by Administrator on 2018/7/12.
 * 用于RMIS系统发起请求后，我将数据转发至主席之后，根据主席返回的消息，我对RMIS系统生成returnCode returnMessage的响应map
 */
public class ReturnCodeFactory {

    public static Map<String,Object> createReturnCodeMap(Map<String,Object> dataMap , JSONObject parseObj){
        RetureCodeSheet retureCodeSheet = RetureCodeSheet.getInstance();
        if(parseObj.containsKey("returnCode")){
            String returnCode = parseObj.getString("returnCode");
            dataMap.put("returnCode", returnCode);
            dataMap.put("returnMessage",retureCodeSheet.getRetureCodeMessage(returnCode));
            return dataMap;
        }else {
            dataMap.put("returnCode","9999");
            dataMap.put("returnMessage",retureCodeSheet.getRetureCodeMessage("9999"));
            return dataMap;
        }
    }

}
